//
// Created by 束庆乐 on 2024/12/31.
//
#include "iostream"
using namespace std;

class Person{
public:
    int ma;
    int mb;
public:
    Person(){};
    Person(int a,int b){
        this->ma = a;
        this->mb = b;
    }
//    //成员函数实现+号运算符重载
//    Person operator+(const Person& p){
//        Person temp;
//        temp.ma = this->ma + p.ma;
//        temp.mb = this->mb + p.mb;
//        return temp;
//    }
};
//全局函数实现+号运算符重载
Person operator+(const Person& p1,const Person& p2){
    Person temp(0,0);
    temp.ma = p1.ma + p2.ma;
    temp.mb = p1.mb + p2.mb;
    return temp;
}
//运算符重载 也可以函数重载
Person operator+(const Person& p2,int val){
    Person temp;
    temp.ma = p2.ma + val;
    temp.mb = p2.mb + val;
    return temp;
}

void test(){
    Person p1(10,10);
    Person p2(20,20);
    Person p3 = p1+p2;
    cout << "ma==" << p3.ma << " mb==" << p3.mb << endl;
    Person p4 = p3 + 10;
    cout << "ma==" << p4.ma << " mb==" << p4.mb << endl;


}

int main072(){
    test();

    return 0;
}